﻿using System;
using System.Collections.Generic;
/*********************************************
  *based on Author: resaberonjr
 * DateWritten: 09/2011
 *********************************************/
using System.Linq;
using System.Text;
using System.Linq.Expressions;


namespace RootBaseFramework.Domain

{
    public interface IRepository<TEntity, TKey>
        where TEntity : class
    {
        TEntity Find(TKey entityId);
        TEntity Find(Expression<Func<TEntity, bool>> filter);

        IEnumerable<TEntity> FindAll();
        IEnumerable<TEntity> FindAll(bool includeChildren);
        IEnumerable<TEntity> FindAll(Expression<Func<TEntity, bool>> filter);
        IEnumerable<TEntity> FindAll(Expression<Func<TEntity, bool>> filter, bool includeChildren);
        IEnumerable<TEntity> FindAll(int pageIndex, int pageSize);
        IEnumerable<TEntity> FindAll(int pageIndex, int pageSize, bool includeChildren);
        IEnumerable<TEntity> FindAll(Expression<Func<TEntity, bool>> filter, int pageIndex, int pageCount);
        IEnumerable<TEntity> FindAll(Expression<Func<TEntity, bool>> filter, int pageIndex, int pageCount, bool includeChildren);
      

        int Count();
        int Count(Expression<Func<TEntity, bool>> filter);
        //int Count(Specification<TEntity> spec);
        //IEnumerable<TEntity> FindAll(Specification<TEntity> spec);
        //IEnumerable<TEntity> FindAll(Specification<TEntity> spec, bool includeChildren);

        void Add(TEntity entity);

        void Update(TEntity entity);

        void Remove(TEntity entity);

        // void Save();
    }
}
